#tag Class
Class NSCalendar
Inherits NSObject
	#tag Method, Flags = &h1000
		 Shared Function AutoupdatingCurrentCalendar() As NSCalendar
		  
		  #if TargetMacOS
		    declare function autoupdatingCurrentCalendar lib CocoaLib selector "autoupdatingCurrentCalendar" (class_id as Ptr) as Ptr
		    
		    dim calendarRef as Ptr = autoupdatingCurrentCalendar(ClassRef)
		    if calendarRef <> nil then
		      return new NSCalendar(calendarRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h21
		Private Shared Function ClassRef() As Ptr
		  
		  static ref as Ptr = Cocoa.NSClassFromString("NSCalendar")
		  return ref
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Components(unitFlags as UInt32, aDate as NSDate) As NSDateComponents
		  
		  #if targetMacOS
		    declare function components lib CocoaLib selector "components:fromDate:" (obj_id as Ptr, unitFlags as UInt32, aDate as Ptr) as Ptr
		    
		    dim dateRef as Ptr
		    if aDate <> nil then
		      dateRef = aDate
		    end if
		    
		    dim componentsRef as Ptr = components(self, unitFlags, dateRef)
		    
		    if componentsRef <> nil then
		      return new NSDateComponents(componentsRef)
		    end if
		    
		  #else
		    #pragma unused unitFlags
		    #pragma unused aDate
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Components(unitFlags as UInt32, fromDate as NSDate, toDate as NSDate) As NSDateComponents
		  
		  #if targetMacOS
		    declare function components lib CocoaLib selector "components:fromDate:toDate:options:" _
		    (obj_id as Ptr, unitFlags as UInt32, fromDate as Ptr, toDate as Ptr) as Ptr
		    
		    dim fromDateRef as Ptr
		    if fromDate <> nil then
		      fromDateRef = fromDate
		    end if
		    
		    dim toDateRef as Ptr
		    if toDate <> nil then
		      toDateRef = toDate
		    end if
		    
		    dim componentsRef as Ptr = components(self, unitFlags, fromDateRef, toDateRef)
		    
		    if componentsRef <> nil then
		      return new NSDateComponents(componentsRef)
		    end if
		    
		  #else
		    #pragma unused unitFlags
		    #pragma unused fromDate
		    #pragma unused toDate
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Sub Constructor(aString as String)
		  
		  #if targetMacOS
		    declare function initWithCalendarIdentifier lib CocoaLib selector "initWithCalendarIdentifier:" (obj_id as Ptr, aString as CFstringRef) as Ptr
		    
		    super.Constructor(initWithCalendarIdentifier(Allocate("NSCalendar"), aString), NSCalendar.hasOwnership)
		    
		  #else
		    #pragma unused aString
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1000
		 Shared Function CurrentCalendar() As NSCalendar
		  
		  #if TargetMacOS
		    declare function currentCalendar lib CocoaLib selector "currentCalendar" (class_id as Ptr) as Ptr
		    
		    dim calendarRef as Ptr = currentCalendar(ClassRef)
		    if calendarRef <> nil then
		      return new NSCalendar(calendarRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function DateByAddingComponents(comps as NSDateComponents, aDate as NSDate, options as UInt32) As NSDate
		  
		  #if targetMacOS
		    declare function dateByAddingComponents lib CocoaLib selector "dateByAddingComponents:toDate:options:" _
		    (obj_id as Ptr, comps as Ptr, aDate as Ptr, options as UInt32) as Ptr
		    
		    dim compsRef as Ptr
		    if comps <> nil then
		      compsRef = comps
		    end if
		    
		    dim aDateRef as Ptr
		    if aDate <> nil then
		      aDateRef = aDate
		    end if
		    
		    dim dateRef as Ptr = dateByAddingComponents(self, compsRef, aDateRef, options)
		    
		    if dateRef <> nil then
		      return new NSDate(dateRef)
		    end if
		    
		  #else
		    #pragma unused comps
		    #pragma unused aDate
		    #pragma unused options
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function DateFromComponents(comps as NSDateComponents) As NSDate
		  
		  #if targetMacOS
		    declare function dateFromComponents lib CocoaLib selector "dateFromComponents:" (obj_id as Ptr, comps as Ptr) as Ptr
		    
		    dim compsRef as Ptr
		    if comps <> nil then
		      compsRef = comps
		    end if
		    
		    dim dateRef as Ptr = dateFromComponents(self, compsRef)
		    
		    if dateRef <> nil then
		      return new NSDate(dateRef)
		    end if
		    
		  #else
		    #pragma unused comps
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function MaximumRangeOfUnit(unit as UInt32) As Cocoa.NSRange
		  
		  #if targetMacOS
		    declare function maximumRangeOfUnit lib CocoaLib selector "maximumRangeOfUnit:" (obj_id as Ptr, unit as UInt32) as Cocoa.NSRange
		    
		    return maximumRangeOfUnit(self, unit)
		    
		  #else
		    #pragma unused unit
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function MinimumRangeOfUnit(unit as UInt32) As Cocoa.NSRange
		  
		  #if targetMacOS
		    declare function minimumRangeOfUnit lib CocoaLib selector "minimumRangeOfUnit:" (obj_id as Ptr, unit as UInt32) as Cocoa.NSRange
		    
		    return minimumRangeOfUnit(self, unit)
		    
		  #else
		    #pragma unused unit
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function OrdinalityOfUnit(smaller as UInt32, larger as UInt32, aDate as NSDate) As UInt32
		  
		  #if targetMacOS
		    declare function ordinalityOfUnit lib CocoaLib selector "ordinalityOfUnit:inUnit:forDate:" _
		    (obj_id as Ptr, smaller as UInt32, larger as UInt32, aDate as Ptr) as UInt32
		    
		    dim dateRef as Ptr
		    if aDate <> nil then
		      dateRef = aDate
		    end if
		    
		    return ordinalityOfUnit(self, smaller, larger, dateRef)
		    
		  #else
		    #pragma unused smaller
		    #pragma unused larger
		    #pragma unused aDate
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function RangeOfUnit(smaller as UInt32, larger as UInt32, aDate as NSDate) As Cocoa.NSRange
		  
		  #if targetMacOS
		    declare function rangeOfUnit lib CocoaLib selector "rangeOfUnit:inUnit:forDate:" _
		    (obj_id as Ptr, smaller as UInt32, larger as UInt32, aDate as Ptr) as Cocoa.NSRange
		    
		    dim dateRef as Ptr
		    if aDate <> nil then
		      dateRef = aDate
		    end if
		    
		    return rangeOfUnit(self, smaller, larger, dateRef)
		    
		  #else
		    #pragma unused smaller
		    #pragma unused larger
		    #pragma unused aDate
		  #endif
		  
		End Function
	#tag EndMethod


	#tag ComputedProperty, Flags = &h0
		#tag Getter
			Get
			  
			  #if targetMacOS
			    declare function firstWeekday lib CocoaLib selector "firstWeekday" (obj_id as Ptr) as UInt32
			    
			    return firstWeekday(self)
			    
			  #endif
			  
			End Get
		#tag EndGetter
		#tag Setter
			Set
			  
			  #if targetMacOS
			    declare sub setFirstWeekday lib CocoaLib selector "setFirstWeekday:" (obj_id as Ptr, weekday as UInt32)
			    
			    setFirstWeekday self, value
			    
			  #else
			    #pragma unused value
			  #endif
			  
			End Set
		#tag EndSetter
		FirstWeekday As UInt32
	#tag EndComputedProperty

	#tag ComputedProperty, Flags = &h0
		#tag Getter
			Get
			  
			  #if targetMacOS
			    declare function calendarIdentifier lib CocoaLib selector "calendarIdentifier" (obj_id as Ptr) as CFStringRef
			    
			    return calendarIdentifier(self)
			    
			  #endif
			  
			End Get
		#tag EndGetter
		Identifier As String
	#tag EndComputedProperty

	#tag ComputedProperty, Flags = &h0
		#tag Getter
			Get
			  
			  #if targetMacOS
			    declare function locale lib CocoaLib selector "locale" (obj_id as Ptr) as Ptr
			    
			    dim localeRef as Ptr = locale(self)
			    if localeRef <> nil then
			      return new NSLocale(localeRef)
			    end if
			    
			  #endif
			  
			End Get
		#tag EndGetter
		#tag Setter
			Set
			  
			  #if targetMacOS
			    declare sub setLocale lib CocoaLib selector "setLocale:" (obj_id as Ptr, aLocale as Ptr)
			    
			    dim localeRef as Ptr
			    if value <> nil then
			      localeRef = value
			    end if
			    
			    setLocale self, localeRef
			    
			  #else
			    #pragma unused value
			  #endif
			  
			End Set
		#tag EndSetter
		Locale As NSLocale
	#tag EndComputedProperty

	#tag ComputedProperty, Flags = &h0
		#tag Getter
			Get
			  
			  #if targetMacOS
			    declare function minimumDaysInFirstWeek lib CocoaLib selector "minimumDaysInFirstWeek" (obj_id as Ptr) as UInt32
			    
			    return minimumDaysInFirstWeek(self)
			    
			  #endif
			  
			End Get
		#tag EndGetter
		#tag Setter
			Set
			  
			  #if targetMacOS
			    declare sub setMinimumDaysInFirstWeek lib CocoaLib selector "setMinimumDaysInFirstWeek:" (obj_id as Ptr, mdw as UInt32)
			    
			    setMinimumDaysInFirstWeek self, value
			    
			  #else
			    #pragma unused value
			  #endif
			  
			End Set
		#tag EndSetter
		MinimumDaysInFirstWeek As UInt32
	#tag EndComputedProperty

	#tag ComputedProperty, Flags = &h0
		#tag Getter
			Get
			  
			  #if targetMacOS
			    declare function timeZone lib CocoaLib selector "timeZone" (obj_id as Ptr) as Ptr
			    
			    dim tzRef as Ptr = timeZone(self)
			    if tzRef <> nil then
			      return new NSTimeZone(tzRef)
			    end if
			    
			  #endif
			  
			End Get
		#tag EndGetter
		#tag Setter
			Set
			  
			  #if targetMacOS
			    declare sub setTimeZone lib CocoaLib selector "setTimeZone:" (obj_id as Ptr, tz as Ptr)
			    
			    dim tzRef as Ptr
			    if value <> nil then
			      tzRef = value
			    end if
			    
			    setTimeZone self, tzRef
			    
			  #else
			    #pragma unused value
			  #endif
			  
			End Set
		#tag EndSetter
		TimeZone As NSTimeZone
	#tag EndComputedProperty


	#tag Constant, Name = NSCalendarCalendarUnit, Type = Double, Dynamic = False, Default = \"1048576", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSDayCalendarUnit, Type = Double, Dynamic = False, Default = \"16", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSEraCalendarUnit, Type = Double, Dynamic = False, Default = \"2", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSHourCalendarUnit, Type = Double, Dynamic = False, Default = \"32", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSMinuteCalendarUnit, Type = Double, Dynamic = False, Default = \"64", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSMonthCalendarUnit, Type = Double, Dynamic = False, Default = \"8", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSQuarterCalendarUnit, Type = Double, Dynamic = False, Default = \"2048", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSSecondCalendarUnit, Type = Double, Dynamic = False, Default = \"128", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSTimeZoneCalendarUnit, Type = Double, Dynamic = False, Default = \"2097152", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWeekCalendarUnit, Type = Double, Dynamic = False, Default = \"256", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWeekdayCalendarUnit, Type = Double, Dynamic = False, Default = \"512", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWeekdayOrdinalCalendarUnit, Type = Double, Dynamic = False, Default = \"1024", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWeekOfMonthCalendarUnit, Type = Double, Dynamic = False, Default = \"4096", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWeekOfYearCalendarUnit, Type = Double, Dynamic = False, Default = \"8192", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSWrapCalendarComponents, Type = Double, Dynamic = False, Default = \"1", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSYearCalendarUnit, Type = Double, Dynamic = False, Default = \"4", Scope = Public
	#tag EndConstant

	#tag Constant, Name = NSYearForWeekOfYearCalendarUnit, Type = Double, Dynamic = False, Default = \"16384", Scope = Public
	#tag EndConstant


	#tag ViewBehavior
		#tag ViewProperty
			Name="Description"
			Group="Behavior"
			Type="String"
			EditorType="MultiLineEditor"
			InheritedFrom="NSObject"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Identifier"
			Group="Behavior"
			Type="String"
			EditorType="MultiLineEditor"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Class
#tag EndClass
